import { request } from 'umi';

// 获取当前用户信息
export async function currentUser() {
  return request('/api/user/info', {
    method: 'GET',
  });
}

// 获取用户列表
export async function getUsers(params) {
  return request('/api/user/list', {
    method: 'GET',
    params,
  });
}

// 添加用户
export async function addUser(data) {
  return request('/api/user/add', {
    method: 'POST',
    data,
  });
}

// 更新用户
export async function updateUser(data) {
  return request('/api/user/update', {
    method: 'PUT',
    data,
  });
}

// 删除用户
export async function deleteUser(id) {
  return request(`/api/user/delete/${id}`, {
    method: 'DELETE',
  });
}

// 修改密码
export async function changePassword(params) {
  return request('/api/v1/user/change_password', {
    method: 'POST',
    data: params,
  });
}